package com.wiegand.gui.button.views {
	import com.wiegand.gui.text.CssTextSprite;
	import com.wiegand.util.ColorRectangle;

	import flash.display.MovieClip;
	import flash.display.Sprite;

	/**
	 * @author kwiegand
	 */
	public class ButtonViewNavSpec extends AbstractButtonView {
		
		private var _hSpace : int = 20;
		private var _vSpace : int = 5;
		private var _r3Width : int = 1;
		private var _r1Space : int = 1;
		private var _r1Width : int = 50;
				
		override public function getUpState( xml : XMLList ) : MovieClip {
			var s : MovieClip = new MovieClip;	
			var container : Sprite = new Sprite();
			container.name = "con";	
			var t : Sprite = CssTextSprite.create( xml, xml.@style  );
			t.x = _hSpace;
			t.y = _vSpace;
			var r1 : Sprite = ColorRectangle.create( 0x000000, .75, _r1Width, t.height + 2 * _vSpace );
			r1.name="pre";
			r1.x = -(_r1Space + _r1Width);
			s.addChild( r1 );
			var r2 : Sprite = ColorRectangle.create( 0x000000, 1, t.width + 2 * _hSpace, t.height + 2 * _vSpace );
			container.addChild( r2 );	
			var r3 : Sprite = ColorRectangle.create( 0x000000, .75, _r3Width, t.height + 2 * _vSpace );
			r3.name="bar";
			r3.x = r2.x+r2.width+1;
			s.addChild( r3 );
			container.addChild( t );	
			s.addChild(container);
			return s;
		}
		
		override public function getOverState( xml : XMLList ) : MovieClip {
			var s : MovieClip = new MovieClip;	
			var container : Sprite = new Sprite();
			container.name = "con";	
			var t : Sprite = CssTextSprite.create( xml, xml.@style+"Over"  );
			t.x = _hSpace;
			t.y = _vSpace;
			var r1 : Sprite = ColorRectangle.create( 0x000000, .75, _r1Width, t.height + 2 * _vSpace );
			r1.name="pre";
			r1.x = -(_r1Space + _r1Width);
			s.addChild( r1 );
			var r2 : Sprite = ColorRectangle.create( 0xffffff, 1, t.width + 2 * _hSpace, t.height + 2 * _vSpace );
			container.addChild( r2 );	
			var r3 : Sprite = ColorRectangle.create( 0x000000, .75, _r3Width, t.height + 2 * _vSpace );
			r3.name="bar";
			r3.x = r2.x+r2.width+1;
			s.addChild( r3 );
			container.addChild( t );	
			s.addChild(container);
			return s;	
		}
		
		override public function getDownState( xml : XMLList ) : MovieClip {
			var s : MovieClip = new MovieClip;	
			var container : Sprite = new Sprite();
			container.name = "con";	
			var t : Sprite = CssTextSprite.create( xml, xml.@style+"Down"  );
			t.x = _hSpace;
			t.y = _vSpace;
			var r1 : Sprite = ColorRectangle.create( 0x000000, .75, _r1Width, t.height + 2 * _vSpace );
			r1.name="pre";
			r1.x = -(_r1Space + _r1Width);
			s.addChild( r1 );
			var r2 : Sprite = ColorRectangle.create( 0x000000, 1, t.width + 2 * _hSpace, t.height + 2 * _vSpace );
			container.addChild( r2 );	
			var r3 : Sprite = ColorRectangle.create( 0x000000, .75, _r3Width, t.height + 2 * _vSpace );
			r3.name="bar";
			r3.x = r2.x+r2.width+1;
			s.addChild( r3 );
			container.addChild( t );	
			s.addChild(container);
			return s;	
		}
		
	}
}
